package main

import "fmt"

func main() {
	adjustTemp, originalTemp := createTemperatureAdjuster()
	fmt.Printf("Original  temperature: %.1fC\n", originalTemp)

	fmt.Printf("Adjusted Temp +1.5: %.1fC\n", adjustTemp(1.50))
	fmt.Printf("Adjusted Temp -3.0: %.1fC\n", adjustTemp(-3.0))
	fmt.Printf("Adjusted Temp +5.0: %.1fC\n", adjustTemp(5.0))
	fmt.Printf("Original  temperature: %.1fC\n", originalTemp)
	adjustTemp1, originalTemp1 := createTemperatureAdjuster()
	fmt.Printf("Original  temperature1: %.1fC\n", originalTemp1)
	fmt.Printf("Adjusted Temp1 +1.5: %.1fC\n", adjustTemp1(1.50))

}

// func createTemperatureAdjuster() func(change float64) float64 {
// 	baseTemperature := 90.0
// 	adjustTemperature := func(change float64) float64 {
// 		baseTemperature = baseTemperature + change
// 		return baseTemperature
// 	}
// 	return adjustTemperature
// }

// func createTemperatureAdjuster() func(float64) float64 {
// 	baseTemperature := 90.0
// 	adjustTemperature := func(change float64) float64 {
// 		baseTemperature = baseTemperature + change
// 		return baseTemperature
// 	}
// 	return adjustTemperature
// }

func createTemperatureAdjuster() (func(change float64) float64, float64) {
	baseTemperature := 90.0
	adjustTemperature := func(change float64) float64 {
		baseTemperature = baseTemperature + change
		return baseTemperature
	}
	return adjustTemperature, baseTemperature
}
